<template>
    <view class="posting-btn">
<!--        <view class="posting-mask" v-if="HidePost" @click="addButton"></view>-->
        <view class="posting-btn-nav">
<!--            <view v-if="HidePost">-->
<!--                <button @click.stop="skipPosting"><img src="/static/img/picture.png" /></button>-->
<!--                <button @click.stop="chooseVideo"><img src="../../../static/img/video.png" /></button>-->
<!--&lt;!&ndash;                                <button><img src="../../../static/img/jia.png" /></button>&ndash;&gt;-->
<!--            </view>-->
<!--            <button @click.stop="addButton"><img src="/static/img/jia.png" /></button>-->
            <view class="btn-add" @click.stop="skipPosting"><img src="http://rzkeji.oss-cn-shenzhen.aliyuncs.com/web/bbMachine/jia-black.png" /></view>
        </view>
    </view>
</template>

<script>
    export default {
        name: "posting-btn",
        props:{
            fatherValue:{
                required: true
            },
            Isfollow:{
                required: true
            }
        },
        data(){
            return{
                HidePost:this.fatherValue
            }
        },
        methods:{
            //选择视频
            chooseVideo(){
                if (this.Isfollow.is_follow == 1){
                    uni.chooseVideo({
                        sourceType: ['album', 'camera'], //可选择性开放访问相册、相机
                        camera: 'back',
                        maxDuration:60,
                        success: res => {
                            uni.navigateTo({
                                url : '/pages/posting/videostickers/videostickers?videoUrl='+res.tempFilePath
                            })
                        }
                    })
                } else {
                    uni.showToast({
                        icon:'none',
                        title:"请先关注圈子才能发帖~"
                    })
                }

            },
            //点击加号按钮
            addButton(){
                if (this.HidePost){
                    this.HidePost = false
                } else {
                    this.HidePost = true
                }
            },
            //跳转到相应的发帖编辑页
            skipPosting(){
                if (this.Isfollow.is_follow == 1){
                    uni.navigateTo({
                        url : '/pages/posting/graphicposts/graphicposts?circleName='+this.Isfollow.name+'&circle_id='+this.Isfollow.id
                    })
                } else {
                    uni.showToast({
                        icon:'none',
                        title:"请先关注圈子才能发帖~"
                    })
                }

            },
        },
        watch:{
            HidePost(newValue, oldValue){
                this.$emit('update:fatherValue',newValue)
            },
            fatherValue(newValue){
                this.HidePost = newValue
            }
        }
    }
</script>

<style scoped lang="scss">
    .posting-btn{
        .posting-mask{
            width: 100vw;
            height: 100vh;
            position: fixed;
            z-index: 100;
            top: 0;
            right: 0;
            background: rgba(0, 0, 0, 0.4);
        }
        .posting-btn-nav{
            position: fixed;
            z-index: 11;
            right: 24rpx;
            bottom: 74rpx;
            /*view button{*/
            /*    margin: 10rpx 0;*/
            /*    background: #d81e06;*/
            /*}*/
            /*view button img{*/
            /*    width: 50%;*/
            /*    height: 50%;*/
            /*    margin: 25%;*/
            /*    background: #d81e06;*/
            /*}*/
            .btn-add{
                width: 34rpx;
                height: 34rpx;
                border: none;
                border-radius: 360rpx;
                padding: 38rpx;
                background: rgba(255,226,38,0.6);;
            }
            .btn-add img{
                width: 100%;
                height: 100%;
            }
        }
    }
</style>